using System;
using System.Xml.Serialization;
using System.IO;

namespace week2_opdracht1
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			// Create a Student Service object
			StudentServiceService studentService = new StudentServiceService();
			
			//Make call to webservice
			String result = studentService.getStudent("Piet");
			
			//Deserilize XML response to an object
			XmlSerializer serializer = new XmlSerializer(typeof(Student));
			StringReader reader = new StringReader(result);
			Student student = (Student)serializer.Deserialize(reader);
			
			//Write result back to console.
			Console.WriteLine("Naam: "+student.naam);
			Console.WriteLine("Leeftijd: "+student.leetijd);
			Console.WriteLine("Geslacht: "+student.geslacht);
			Console.WriteLine("\n");
			Console.WriteLine("Opgemaakt uit response van webservice:");
			Console.WriteLine("------------------------");
			Console.WriteLine(result);
			Console.WriteLine("------------------------");
		}
	}
}
